package com.acme.task6;

import java.io.*;

public class CommentRemover2 {

	public static void main(String[] args) {
		String row;
		String fileName = System.getProperty("user.dir")
				+ "\\lab-08\\src\\com\\acme\\task6\\test.txt";
		boolean inComment = false;
		int i;

		try {
			BufferedReader br = new BufferedReader(new InputStreamReader(
					new FileInputStream(fileName)));

			while ((row = br.readLine()) != null) {

				i = row.indexOf("//");
				if ((i > -1) && (!inComment))
					row = row.substring(0, i);

				i = row.indexOf("/*");
				if (i > -1) {
					row = row.substring(0, i);
					inComment = true;
				}

				i = row.indexOf("*/");
				if ((i > -1) && inComment ){
					row = row.substring(i + 2);
					inComment = false;
				}

				if (!inComment)
					System.out.println(row);
			}

			br.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
